# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-pyelftools
_pkgname=pyelftools
pkgver=0.25
pkgrel=2
pkgdesc='Python library for analyzing ELF files and DWARF debugging information.'
url='https://github.com/eliben/pyelftools'
arch=('any')
license=('custom:Public Domain')
depends=('python2')
makedepends=('python2-setuptools')
options=('!strip')
source=("$_pkgname-$pkgver.tar.gz::https://github.com/eliben/$_pkgname/archive/v$pkgver.tar.gz")
sha512sums=('84fbff3a8abc1d0d47e2113d14f509a6a0e8fb97d09c6abf91cefb416b7237d31f53945627e3958901b2a5229f57d5d2ffc9e0b7b4cd271f61689781dc6871bc')

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.rst CHANGES
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cp -r examples "$pkgdir/usr/share/doc/$pkgname"

  mv "$pkgdir/usr/bin/readelf.py" "$pkgdir/usr/bin/readelf.py2"
}

